import request from '@/utils/request'

// 查询班级列表
export function listClass(query) {
  return request({
    url: '/system/class/list',
    method: 'get',
    params: query
  })
}

// 查询班级详细
export function getClass(classId) {
  return request({
    url: '/system/class/' + classId,
    method: 'get'
  })
}

// 新增班级
export function addClass(data) {
  return request({
    url: '/system/class',
    method: 'post',
    data: data
  })
}

// 修改班级
export function updateClass(data) {
  return request({
    url: '/system/class',
    method: 'put',
    data: data
  })
}

// 删除班级
export function delClass(classId) {
  return request({
    url: '/system/class/' + classId,
    method: 'delete'
  })
}

// 查询班级已分配学员列表
export function listAssignedStudnet(query) {
  return request({
    url: '/system/class/student/assigned/' + query.classId,
    method: 'get',
    params: query
  })
}

// 查询班级未分配学员列表
export function listAllStudent() {
  return request({
    url: '/system/class/student/listAll',
    method: 'get',
    params: {}
  })
}

// 批量选择用户授权
export function selectAuthUserAll(data) {
  return request({
    url: '/system/class/student/selectAll',
    method: 'post',
    params: data
  })
}

// 授权用户
export function addBatch(classId, userIds) {
  return request({
    url: '/system/class/student/addBatch/' + classId + '/' + userIds,
    method: 'post'
  })
}

// 取消指定用户授权
export function cancelAuthUser(data) {
  return request({
    url: '/system/class/student/cancel',
    method: 'delete',
    params: data
  })
}

// 批量取消用户授权
export function cancelAuthUserAll(data) {
  return request({
    url: '/system/class/student/cancelAll',
    method: 'delete',
    params: data
  })
}
